// './profile.mjs' 这里用的是单引号
import {firstName,lastName,year} from './profile.mjs'

console.log(firstName)

// import { MYAPP } from './modul.mjs'
// console.log(MYAPP.name)

import pkg1 from './modul.mjs'
console.log(pkg1.name)
console.log(pkg1.fn())

// if 判断
var a = 10

if (a > 10) {
    console.log(a)
} else if (a > 20) {
    console.log(a)
} else {
    console.log("test", a)
}

var x = 0;
for (let i=1; i<=10000; i++) {
    x = x + i;
}
console.log(x)

// for 循环
// 方式1：for of 不能直接对对象做循环，要通过 Object.keys()转化
// 方式2：forEach
var a1 = [1,3,4,5]
for (x of a1){
    console.log(x)
}

var a2 = {
    name: 'Jack',
    age: 20,
    city: 'Beijing'
}

var k2 = Object.keys(a2)
for (x of k2) {
    console.log(x)
}

// forEach()
var f = (item) => console.log(item)
a1.forEach(f)
var f = (item) => console.log(item)
k2.forEach(f)